import request from '@/utils/request'

// 查询需求信息列表
export function listRequirement(query) {
  return request({
    url: '/pms/requirement/',
    method: 'get',
    params: query
  })
}

// 查询需求信息详细
export function getRequirement(id) {
  return request({
    url: `/pms/requirement/${id}/`,
    method: 'get'
  })
}

// 查询需求详细历史
export function getHistory(id) {
  return request({
    url: `/pms/requirement/${id}/history/`,
    method: 'get',
  })
}

// 新增需求信息
export function addRequirement(data) {
  return request({
    url: '/pms/requirement/',
    method: 'post',
    data: data
  })
}

// 修改需求信息
export function updateRequirement(data) {
  return request({
    url: `/pms/requirement/${data.id}/`,
    method: 'put',
    data: data
  })
}

// 删除需求信息
export function delRequirement(id) {
  return request({
    url: `/pms/requirement/${id}/`,
    method: 'delete'
  })
}

// 查询需求下拉树结构
export function treeselect(query) {
  return request({
    url: '/pms/requirement/treeselect/',
    method: 'get',
    params: query
  })
}